package com.wbs.controller;

import com.wbs.model.TbAdmin;
import com.wbs.model.TbSeller;
import com.wbs.resutil.PageBean;
import com.wbs.resutil.PageResult;
import com.wbs.resutil.Result;
import com.wbs.service.SellerService;
import com.wbs.vo.SellerVo;
import com.wbs.vo.TypeTemplateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 芝梦
 * @Description: 商家管理控制层
 * @DateTime: 2024/1/26 20:01
 */
@RequestMapping("seller")
@RestController
public class SellerController {
    @Autowired
    private SellerService sellerService;

    @GetMapping("selectSellerBySellerId")
    public TbSeller selectSellerBySellerId(@RequestParam String sellerId){
        TbSeller tbSeller = sellerService.selectSellerBySellerId(sellerId);
        return tbSeller;
    }

    //注册
    @PostMapping("register")
    public Result register(@RequestBody TbSeller tbSeller){
        return sellerService.register(tbSeller);
    }

    //按条件页面查找
    @PostMapping("findByConditionPage")
    public Result findByConditionPage(@RequestBody PageBean<SellerVo> pageBean){
        PageResult<SellerVo> pageResult = sellerService.findByConditionPage(pageBean);
        return Result.SUCCESS().setData(pageResult);
    }

    //
    @PutMapping("update")
    public Result update(@RequestParam String status, @RequestParam String sellerId){
        sellerService.update(status,sellerId);
        return Result.SUCCESS();
    }
}
